.Label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--color-gray-900);
  position: relative;
}

.InputWrapper {
  position: relative;
  width: 16rem;

  @media (min-width: 500px) {
    width: 20rem;
  }

  &:has(.Clear) .Input {
    padding-right: calc(0.5rem + 1.5rem * 2);
  }
}

.Input {
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  height: 2.5rem;
  padding-left: 0.875rem;
  padding-right: calc(0.5rem + 1.5rem);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.375rem;
  font-family: inherit;
  font-size: 1rem;
  background-color: canvas;
  color: var(--color-gray-900);

  &:focus {
    outline: 2px solid var(--color-blue);
    outline-offset: -1px;
  }
}

.ActionButtons {
  box-sizing: border-box;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  bottom: 0;
  height: 2.5rem;
  right: 0.5rem;
  border-radius: 0.25rem;
  border: none;
  color: var(--color-gray-600);
  padding: 0;
}

.Trigger,
.Clear {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 2.5rem;
  color: var(--color-gray-600);
  border: none;
  padding: 0;
  border-radius: 0.25rem;
  background: none;
}

.ClearIcon,
.TriggerIcon {
  width: 1rem;
  height: 1rem;
}

.Positioner {
  outline: 0;
}

.Popup {
  box-sizing: border-box;
  padding-block: 0.5rem;
  border-radius: 0.375rem;
  background-color: canvas;
  color: var(--color-gray-900);
  width: var(--anchor-width);
  max-height: min(var(--available-height), 23rem);
  max-width: var(--available-width);
  overflow-y: auto;
  scroll-padding-block: 0.5rem;
  overscroll-behavior: contain;
  transition:
    opacity 0.1s,
    transform 0.1s;
  transform-origin: var(--transform-origin);

  &[data-starting-style] {
    opacity: 0;
    transform: scale(0.95);
  }

  &[data-ending-style] {
    transition: none;
  }

  @media (prefers-color-scheme: light) {
    outline: 1px solid var(--color-gray-200);
    box-shadow:
      0 10px 15px -3px var(--color-gray-200),
      0 4px 6px -4px var(--color-gray-200);
  }

  @media (prefers-color-scheme: dark) {
    outline: 1px solid var(--color-gray-300);
    outline-offset: -1px;
  }
}

.Status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.25rem;
  padding-left: 1rem;
  padding-right: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--color-gray-600);
}

.Status:empty {
  display: none;
}

.Spinner {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 10rem;
  border: 1px solid currentColor;
  border-right-color: transparent;
  animation: comboboxSpinner 0.75s linear infinite;
}

.Spinner:dir(rtl) {
  border-right-color: currentColor;
  border-left-color: transparent;
}

@keyframes comboboxSpinner {
  100% {
    transform: rotate(360deg);
  }
}

.Item {
  box-sizing: border-box;
  outline: 0;
  cursor: default;
  user-select: none;
  padding-block: 0.5rem;
  padding-inline: 1rem;
  padding-right: 1.25rem;
  display: grid;
  gap: 0.5rem;
  align-items: flex-start;
  grid-template-columns: 0.75rem 1fr;
  font-size: 1rem;
  line-height: 1.2rem;

  @media (hover: hover) {
    &[data-highlighted] {
      z-index: 0;
      position: relative;
      color: var(--color-gray-900);
    }

    &[data-highlighted]::before {
      content: '';
      z-index: -1;
      position: absolute;
      inset-block: 0;
      inset-inline: 0.5rem;
      border-radius: 0.25rem;
      background-color: var(--color-gray-100);
    }
  }
}

.ItemIndicator {
  grid-column-start: 1;
  margin-top: 0.25rem;
}

.ItemIndicatorIcon {
  display: block;
  width: 0.75rem;
  height: 0.75rem;
}

.ItemText {
  grid-column-start: 2;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ItemTitle {
  font-size: 0.95rem;
  font-weight: 500;
}

.ItemSubtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-gray-600);
}

.ItemUsername {
  opacity: 0.8;
}

.ItemEmail {
  font-size: 0.75rem;
  opacity: 0.8;
}

.Empty:not(:empty) {
  box-sizing: border-box;
  font-size: 0.875rem;
  line-height: 1rem;
  color: var(--color-gray-600);
  padding: 0.5rem 1rem;
}
